package com.forum.module.blog.dal.dataobject.comment;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.forum.framework.mybatis.core.dataobject.BaseDO;

import java.util.Objects;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/2 18:08
 */
@TableName(value = "blog_comment", autoResultMap = true)
public class CommentDO extends BaseDO {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 文章编号
     */
    private Long articleId;

    /**
     * 评论者编号
     */
    private Long userId;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 父评论编号（0表示顶级评论）
     */
    private Long parentId;

    /**
     * 点赞数
     */
    private Long likes;

    /**
     * 状态（0：正常 1：屏蔽）
     */
    private Integer status;

    public CommentDO() {
    }

    public CommentDO(Long id, Long articleId, Long userId, String content, Long parentId, Long likes, Integer status) {
        this.id = id;
        this.articleId = articleId;
        this.userId = userId;
        this.content = content;
        this.parentId = parentId;
        this.likes = likes;
        this.status = status;
    }

    public Long getId() {
        return id;
    }

    public CommentDO setId(Long id) {
        this.id = id;
        return this;
    }

    public Long getArticleId() {
        return articleId;
    }

    public CommentDO setArticleId(Long articleId) {
        this.articleId = articleId;
        return this;
    }

    public Long getUserId() {
        return userId;
    }

    public CommentDO setUserId(Long userId) {
        this.userId = userId;
        return this;
    }

    public String getContent() {
        return content;
    }

    public CommentDO setContent(String content) {
        this.content = content;
        return this;
    }

    public Long getParentId() {
        return parentId;
    }

    public CommentDO setParentId(Long parentId) {
        this.parentId = parentId;
        return this;
    }

    public Long getLikes() {
        return likes;
    }

    public CommentDO setLikes(Long likes) {
        this.likes = likes;
        return this;
    }

    public Integer getStatus() {
        return status;
    }

    public CommentDO setStatus(Integer status) {
        this.status = status;
        return this;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        CommentDO commentDO = (CommentDO) object;
        return Objects.equals(id, commentDO.id) && Objects.equals(articleId, commentDO.articleId) && Objects.equals(userId, commentDO.userId) && Objects.equals(content, commentDO.content) && Objects.equals(parentId, commentDO.parentId) && Objects.equals(likes, commentDO.likes) && Objects.equals(status, commentDO.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, articleId, userId, content, parentId, likes, status);
    }
}
